<?php
/**
 *
 * 酒店搜索
 * @author liuw2
 *
 */
class OTA_PingSearch{
    /**
     * @var 1 表示通过城市请求酒店，2通过酒 店代码请求详情，3，通过酒店请求价格
     */
    var $tags=1;
    /**
     * @var为真时，只返回可预订酒店；为假时，返回所有已激活酒店 可选
     */
    var $AvailableOnlyIndicator=true;
    /**
     *@var 城市ID 可选 
     */
    var $HotelCityCode ="";   
    /**
     *@var 行政区ID 可选
     */
    var $AreaID="";    
    
    /**
     *@var 酒店名称 可选
     */
    var $HotelName="";      
    
    /**
     *@var string 评分者 HotelStarRate(酒店星级)
		CtripStarRate(携程星级)
		CtripRecommendRate(携程评分)
     */
    var $Provider="";   
    /**
     *@var decimal  分数或级别 可选
	 *----------------------------------------------------------
     */
	 
    var $Rating="";    
    /**
     *@var 酒店的唯一地标识代码  必须填写
     */
    var $HotelCode="";   
    
	
	
	
    /**
     *@var 开始时间 必须填写
     */
    var $Start="";   
    
    /**
     *@var 结束时间 必须填写
     */
    var $End="";   
    
    /**
     *@var 每页显示条数
     */
    var $PageSize=20;       
    /**
     *@var 请求的页数
     */
    var $PageNumber=1;   
    /**
     *@var 酒店的星级,默认无星级要求 必选
     */
    var $StarList='5,4,3,2,1,0,-1';       
	/**
     *@var 酒店的id，支持多酒店查询，用,分隔 可选
     */
    var $HotelList='';   	
	/**
     *@var 酒店的品牌id，(Int) 可选
     */
    var $HotelBrand='';   
    /**
     *@var 酒店的主题， 可选
     */
    var $Feature='MinPrice';   
    /**
     *@var 排序字段,默认携程推荐 必选   Recommend：推荐级别排序
	 *	Star：星级排序
	 *	Price：价格排序        MinPrice：按照起价排序
	 *	HRatingOverall：酒店点评分
	 *	Distance：按照距离排序
	 *	CustomerEval：客户点评分
	 *	PriceRate：价格折扣
	 *	PreferentialPrice：优惠价(门市价-均价)
	 *
     */
    var $OrderName='MinPrice';   
    /**
     *@var 升降顺序，ASC/DESC 
     */
    var $OrderType='ASC'; 
	/**
     *@var 价格类型 FG为只显示现付价格;PP为只显示预付价格 必选 
     */
    var $PriceType='FG'; 
	/**
     *@var 最低价格 可选 
     */
    var $LowPrice='0'; 	
	/**
     *@var 最高价格 可选 
     */
    var $HighPrice='0';   
	/**
     *@var 酒店的地图参数 点选纬度 可选 
     */
    var $DotX='0';   
	/**
     *@var 酒店的地图参数 点选经度 可选 
     */
    var $DotY='0'; 
	/**
     *@var 酒店的地图参数 点选经度 可选 
     */
    var $CityID='';   
	/**
     *@var 酒店的房间id 
     */
    var $RoomID=''; 
	/**
     *@var 订的房间数
     */
    var $Quantity=1; 
		/**
     *@var 订的房间数---xml里用的是Count 
     */
    var $Counts =1; 
	/**
     *@var 用户id 
     */
    var $userid =0; 
	/**  通过接口生成的 UniqueUID
     *@var 用户id 
     */
    var $UniqueUID =0; 
	/**
     *@var text说明
     */
    var $Text =0; 
	/**
     *@var 入住最晚时间 
     */
    var $LateArrivalTime =''; 
	/**
     *@var 入住最早时间 
     */
    var $ArrivalTime =''; 
	/**
     *@var 电话号码类型  1手机号 
     */
    var $PhoneTechType ='1'; 
	/**
     *@var 手机号码  1手机号 
     */
    var $PhoneNumber =''; 
	/**
     *@var 姓名（入住人）  1手机号 
     */
    var $Surname =''; 
	/**
     *@var 姓名（联系人）  1手机号 
     */
    var $Surnames =''; 
	/**
     *@var 
     */
    var $Email =''; 
	/**
     *@var 房间数 
     */
    var $NumberOfUnits ='1'; 
	/**
     *@var  信用卡类型
     */
    var $CardType ='';  
	/**
     *@var  信用卡号码
     */
    var $CardNumber ='';  
	/**
     *@var  持卡人姓名
     */
    var $CardHolderName ='';  




	/**
     *@var  信用卡背后的3位数字，如没有可以不录入
     */
    var $SeriesCode ='';  
	/**
     *@var  生效日期 如果没有和失效日期的值相同。格式（MMYY）
     */
    var $EffectiveDate ='';  
	/**
     *@var  失效日期 格式（MMYY
     */
    var $ExpireDate ='';  
	/**
     *@var  持卡人身份证号
     */
    var $CardHolderIDCard ='';  
	/**
     *@var  
     */
    var $RatePlanCode =''; 
	/**
     *@var  税后订单总价
     */
    var $AmountBeforeTax =''; 
	/**
     *@var  价格单位
     */
    var $CurrencyCode =''; 
	/**
     *@var  订单id
     */
    var $orderid =''; 
	/**
     *@var  是否须要担保 0 不须要，1须要 
     */
    var $DepositPayments ='0'; 

    /**
     *@var返回体
     */
    var $ResponseXML="";
	/**
	* 输入城市查询酒店,及其他信息，可以分页
	*/
	private  function getHotelListXML()
	{
		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="D_HotelSearch";
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		 $HotelList="";
        if($this->HotelList!=""){
            $HotelList=<<<BEGIN
<HotelList>$this->HotelList</HotelList>
BEGIN;
	}	
	$HotelBrand="";
    if($this->HotelBrand!=""){
        $HotelBrand=<<<BEGIN
<HotelBrand>$this->HotelBrand</HotelBrand>
BEGIN;
	}	
	$Feature="";
    if($this->Feature!=""){
        $Feature=<<<BEGIN
<Feature>$this->Feature</Feature>
BEGIN;
	}	
	$OrderName="";
        if($this->OrderName!=""){
            $OrderName=<<<BEGIN
<OrderName>$this->OrderName</OrderName>
BEGIN;
	}	
	$LowPrice='';
        if($this->LowPrice!=""){
            $LowPrice=<<<BEGIN
<LowPrice>$this->LowPrice</LowPrice>
BEGIN;
	}	
	$HighPrice='';
        if($this->HighPrice!=""){
            $HighPrice=<<<BEGIN
<HighPrice>$this->HighPrice</HighPrice>
BEGIN;
	}
    $CityID='';
	if($this->CityID!=''){
            $CityID=<<<BEGIN
<CityID>$this->CityID</CityID>
BEGIN;
	}
    $HotelName='';
	if($this->HotelName!=''){
            $HotelName=<<<BEGIN
<HotelName>$this->HotelName</HotelName>
BEGIN;
	}
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request> 
<Header $headerRight/>     
<DomesticHotelListRequest>
    $CityID
    <CheckInDate>$this->Start</CheckInDate>
    <CheckOutDate>$this->End</CheckOutDate>
    $HotelName
    <PageSize>$this->PageSize</PageSize>
    <PageNumber>$this->PageNumber</PageNumber>
    <StarList>$this->StarList</StarList>
   $HotelList
    $HotelBrand
    $Feature
    $OrderName
    <OrderType>$this->OrderType</OrderType>
    <PriceType>$this->PriceType</PriceType>
	$LowPrice
    $HighPrice
  </DomesticHotelListRequest>
</Request>

BEGIN;
		return  $paravalues;
	}
	
	
		/**
	 *
	 * 调用接口
	 */
	function mainHotelList(){
		try{
			$requestXML=$this->getHotelListXML();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=D_HotelSearch;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
/******************************************************以下都是测试用的********************************************/
	/**
	 * 构造请求体
	 */
	private  function getRequestXML()
	{
		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelDescriptiveInfo";
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request> 
<Header $headerRight/>     
<HotelRequest>
<RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
		 <ns:OTA_HotelSearchRQ Version="1.0" PrimaryLangID="zh" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelSearchRQ.xsd" xmlns="http://www.opentravel.org/OTA/2003/05">
    <ns:Criteria AvailableOnlyIndicator="true">
          <ns:Criterion>
            <ns:HotelRef HotelCityCode="$this->HotelCityCode" AreaID="$this->AreaID"  HotelName="$this->HotelName"/>
            <ns:Award Provider="HotelStarRate" Rating="3"/>
          </ns:Criterion>
</ns:Criteria>
</ns:OTA_HotelSearchRQ>
</RequestBody>
</HotelRequest>
</Request>
BEGIN;
		return  $paravalues;
	}

	/**
	 *
	 * 调用接口
	 */
	function main(){
		try{
			$requestXML=$this->getRequestXML();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_PingSearch_Url;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	 /*
 *通过酒店id查询房型
 */
 
 function hotleStyle(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelDescriptiveInfo";
		
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <OTA_HotelDescriptiveInfoRQ Version="1.0" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelDescriptiveInfoRQ.xsd" xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <HotelDescriptiveInfos>
          <HotelDescriptiveInfo HotelCode="18806">
            <HotelInfo SendData="true"/>
            <FacilityInfo SendGuestRooms="true"/>
            <AreaInfo SendAttractions="true" SendRecreations="true"/>
            <ContactInfo SendData="true"/>
            <MultimediaObjects SendData="true"/>
          </HotelDescriptiveInfo>
        </HotelDescriptiveInfos>
      </OTA_HotelDescriptiveInfoRQ>
	      </RequestBody> 
  </HotelRequest>
</Request>
BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function mainType(){
		try{
			$requestXML=$this->hotleStyle();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_HotelDescriptiveInfo;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
	
	/**********************************************价格查询*****************************/
		 /*
 *通过酒店id查询房型
 */
 
 function hotlePrice(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelRatePlan";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ns:OTA_HotelRatePlanRQ TimeStamp="2012-04-20T00:00:00.000+08:00" Version="1.0">
        <ns:RatePlans>
          <ns:RatePlan>
            <ns:DateRange Start="$this->Start" End="$this->End"/>
            <ns:RatePlanCandidates>
              <ns:RatePlanCandidate RatePlanCode="1594026"  AvailRatesOnlyInd="true">
                <ns:HotelRefs>
                  <ns:HotelRef HotelCode="$this->HotelCode"/>
                </ns:HotelRefs>
              </ns:RatePlanCandidate>
            </ns:RatePlanCandidates>
          </ns:RatePlan>

        </ns:RatePlans>
      </ns:OTA_HotelRatePlanRQ>
    </RequestBody>
  </HotelRequest>
</Request>
BEGIN;
		return  $paravalues;
 
 
 
 }
  function hotlePrices(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelRatePlan";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ns:OTA_HotelRatePlanRQ TimeStamp="2012-04-20T00:00:00.000+08:00" Version="1.0">
        <ns:RatePlans>
   
          <ns:RatePlan>
            <ns:DateRange Start="$this->Start" End="$this->End"/>
            <ns:RatePlanCandidates>
              <ns:RatePlanCandidate AvailRatesOnlyInd="false">
                <ns:HotelRefs>
                  <ns:HotelRef HotelCode="$this->HotelCode"/>
                </ns:HotelRefs>
              </ns:RatePlanCandidate>
            </ns:RatePlanCandidates>
<ns:TPA_Extensions RestrictedDisplayIndicator="false"/>
          </ns:RatePlan>
        </ns:RatePlans>
      </ns:OTA_HotelRatePlanRQ>
    </RequestBody>
  </HotelRequest>
</Request>

BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function priceType(){
		try{
			$requestXML=$this->hotlePrice();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_HotelRatePlan;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	/*******************************价格查询结束 酒店详情 开始*******************/
	
	
	 function hotleDetail(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="D_HotelDetail";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <DomesticHotelProductDetailRequest>
    <CityID>$this->CityID</CityID>
    <HotelID>$this->HotelID</HotelID>
    <CheckInDate>$this->Start</CheckInDate>
    <CheckOutDate>$this->End</CheckOutDate>
  </DomesticHotelProductDetailRequest>
</Request>
BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function hotelDetailmain(){
		try{
			$requestXML=$this->hotleDetail();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=D_HotelDetail;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	/******************************* 酒店详情 结束 *******************/
	/******************************* 可预定查看 开始 查看该房间是否可以预定 *******************/
		 function hotleOrderPriceCk(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelAvail";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ns:OTA_HotelAvailRQ Version="1.0" TimeStamp="2012-04-20T00:00:00.000+08:00">
        <ns:AvailRequestSegments>
          <ns:AvailRequestSegment>
            <ns:HotelSearchCriteria>
              <ns:Criterion>
                <ns:HotelRef HotelCode="$this->HotelCode"/>
                <ns:StayDateRange Start="$this->Start" End="$this->End"/>
				<ns:RatePlanCandidates>
                  <ns:RatePlanCandidate RatePlanCode="$this->RoomID"/>
                </ns:RatePlanCandidates>
                <ns:RoomStayCandidates>
                  <ns:RoomStayCandidate Quantity="$this->Quantity">
                    <ns:GuestCounts IsPerRoom="false">
                      <ns:GuestCount Count="$this->Counts"/>
                    </ns:GuestCounts>
                  </ns:RoomStayCandidate>
                </ns:RoomStayCandidates>
                <ns:TPA_Extensions>
                  <ns:LateArrivalTime>$this->LateArrivalTime</ns:LateArrivalTime>
                </ns:TPA_Extensions>
              </ns:Criterion>
            </ns:HotelSearchCriteria>
          </ns:AvailRequestSegment>
        </ns:AvailRequestSegments>
      </ns:OTA_HotelAvailRQ>
    </RequestBody>
  </HotelRequest>
</Request>

BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function hotleOrderPriceCkmain(){
		try{
			$requestXML=$this->hotleOrderPriceCk();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_HotelAvail;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	/******************************* 可预定查看 结束 *******************/
	/******************************* 生成订单 开始 *******************/
	function HotelRes(){
 
 			/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelRes";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ns:OTA_HotelResRQ TimeStamp="2012-09-01T03:15:57" Version="1.0">
        <ns:UniqueID Type="504" ID="100000"/>
        <ns:UniqueID Type="28" ID="$AllianceID"/>
        <ns:UniqueID Type="503" ID="$SID"/>
        <ns:UniqueID Type="1" ID="$this->UniqueUID"/>
        <ns:HotelReservations>
          <ns:HotelReservation>
            <ns:RoomStays>
              <ns:RoomStay>
                <ns:RoomTypes>
                  <ns:RoomType NumberOfUnits="$this->NumberOfUnits"/>
                </ns:RoomTypes>
                <ns:RatePlans>
                  <ns:RatePlan RatePlanCode="$this->RatePlanCode"/>
                </ns:RatePlans>
                <ns:BasicPropertyInfo HotelCode="$this->HotelCode"/>
              </ns:RoomStay>
            </ns:RoomStays>
            <ns:ResGuests>
              <ns:ResGuest ArrivalTime="$this->ArrivalTime"> 
                <ns:Profiles>
                  <ns:ProfileInfo>
                    <ns:Profile>
                      <ns:Customer>
                        <ns:PersonName>
                          <ns:Surname>$this->Surname</ns:Surname>
                        </ns:PersonName>
                        <ns:ContactPerson ContactType="tel">
                          <ns:PersonName>
                            <ns:Surname>$this->Surnames</ns:Surname>
                          </ns:PersonName>
                          <ns:Telephone PhoneNumber="$this->PhoneNumber" PhoneTechType="$this->PhoneTechType"/>
                          <ns:Email>$this->Email</ns:Email>
                        </ns:ContactPerson>
                      </ns:Customer>
                    </ns:Profile>
                  </ns:ProfileInfo>
                </ns:Profiles>
                <ns:TPA_Extensions>
                  <ns:LateArrivalTime>$this->LateArrivalTime</ns:LateArrivalTime>
                </ns:TPA_Extensions>
              </ns:ResGuest>
            </ns:ResGuests>
            <ns:ResGlobalInfo>
              <ns:GuestCounts IsPerRoom="false">
                <ns:GuestCount Count="$this->Counts"/>
              </ns:GuestCounts>
              <ns:TimeSpan Start="$this->Start" End="$this->End"/>
              <ns:SpecialRequests>
                <ns:SpecialRequest>
                  <ns:Text>$this->Text</ns:Text>
                </ns:SpecialRequest>
              </ns:SpecialRequests>
     
       

              <ns:Total AmountBeforeTax="$this->AmountBeforeTax" CurrencyCode="$this->CurrencyCode"/>

            </ns:ResGlobalInfo>
          </ns:HotelReservation>
        </ns:HotelReservations>
      </ns:OTA_HotelResRQ>
    </RequestBody>
  </HotelRequest>
</Request>



BEGIN;

		return  $paravalues;
 
 
 
 }	
 //须要担保
 function HotelRess(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelRes";
		$HotelCode=$this->HotelCode;
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
  <HotelRequest>
    <RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ns:OTA_HotelResRQ TimeStamp="2012-09-01T03:15:57" Version="1.0">
        <ns:UniqueID Type="504" ID="100000"/>
        <ns:UniqueID Type="28" ID="$AllianceID"/>
        <ns:UniqueID Type="503" ID="$SID"/>
        <ns:UniqueID Type="1" ID="$this->UniqueUID"/>
        <ns:HotelReservations>
          <ns:HotelReservation>
            <ns:RoomStays>
              <ns:RoomStay>
                <ns:RoomTypes>
                  <ns:RoomType NumberOfUnits="$this->NumberOfUnits"/>
                </ns:RoomTypes>
                <ns:RatePlans>
                  <ns:RatePlan RatePlanCode="$this->RatePlanCode"/>
                </ns:RatePlans>
                <ns:BasicPropertyInfo HotelCode="$this->HotelCode"/>
              </ns:RoomStay>
            </ns:RoomStays>
            <ns:ResGuests>
              <ns:ResGuest ArrivalTime="$this->ArrivalTime"> 
                <ns:Profiles>
                  <ns:ProfileInfo>
                    <ns:Profile>
                      <ns:Customer>
                        <ns:PersonName>
                          <ns:Surname>$this->Surname</ns:Surname>
                        </ns:PersonName>
                        <ns:ContactPerson ContactType="tel">
                          <ns:PersonName>
                            <ns:Surname>$this->Surnames</ns:Surname>
                          </ns:PersonName>
                          <ns:Telephone PhoneNumber="$this->PhoneNumber" PhoneTechType="$this->PhoneTechType"/>
                          <ns:Email>$this->Email</ns:Email>
                        </ns:ContactPerson>
                      </ns:Customer>
                    </ns:Profile>
                  </ns:ProfileInfo>
                </ns:Profiles>
                <ns:TPA_Extensions>
                  <ns:LateArrivalTime>$this->LateArrivalTime</ns:LateArrivalTime>
                </ns:TPA_Extensions>
              </ns:ResGuest>
            </ns:ResGuests>
            <ns:ResGlobalInfo>
              <ns:GuestCounts IsPerRoom="false">
                <ns:GuestCount Count="$this->Counts"/>
              </ns:GuestCounts>
              <ns:TimeSpan Start="$this->Start" End="$this->End"/>
              <ns:SpecialRequests>
                <ns:SpecialRequest>
                  <ns:Text>$this->Text</ns:Text>
                </ns:SpecialRequest>
              </ns:SpecialRequests>
         <ns:DepositPayments>
                <ns:GuaranteePayment GuaranteeType="CC/DC/Voucher">
                  <ns:AcceptedPayments>
                    <ns:AcceptedPayment>
                      <ns:PaymentCard CardType="$this->CardType" CardNumber="$this->CardNumber" SeriesCode="$this->SeriesCode" EffectiveDate="$this->EffectiveDate" ExpireDate="$this->ExpireDate">
                        <ns:CardHolderName>$this->CardHolderName</ns:CardHolderName>
                        <ns:CardHolderIDCard>$this->CardHolderIDCard</ns:CardHolderIDCard>
                      </ns:PaymentCard>
                    </ns:AcceptedPayment>
                  </ns:AcceptedPayments>
                  <ns:AmountPercent Amount="$this->AmountBeforeTax"/>
                </ns:GuaranteePayment>
              </ns:DepositPayments>
       

              <ns:Total AmountBeforeTax="$this->AmountBeforeTax" CurrencyCode="$this->CurrencyCode"/>

            </ns:ResGlobalInfo>
          </ns:HotelReservation>
        </ns:HotelReservations>
      </ns:OTA_HotelResRQ>
    </RequestBody>
  </HotelRequest>
</Request>


BEGIN;

		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function HotelResmain(){
	
		try{
		    if($this->DepositPayments==0){
			$requestXML=$this->HotelRes();
			}else{
			$requestXML=$this->HotelRess();
			
			}
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_HotelRes;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
	
	/******************************* 生成订单 开始 *******************/
	
		/******************************* userid生成 *******************/
	function UserUniqueID(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_UserUniqueID";
		
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
	<UserRequest>
		<AllianceID>$AllianceID</AllianceID>
		<SID>$SID</SID>
		<UidKey>$this->userid</UidKey>
	</UserRequest>
</Request>


BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function UserUniqueIDkmain(){
		try{
			$requestXML=$this->UserUniqueID();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_UserUniqueID;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	/******************************* userid生成 结束 *******************/
	/******************************* 3.7.2.10. 订单变化查询 OTA_HotelResNotif 开始 *******************/
		function HotelResNotif(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_HotelResNotif";
		
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   
	<HotelRequest>
		<RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
			<ns:OTA_HotelResNotifRQ Version="1.0">
				<ns:HotelReservations> 
					<ns:HotelReservation LastModifyDateTime="2012-04-20T00:00:00.000+08:00"> 
						<!--AllianceID:-->
						<ns:UniqueID Type="28" ID="$AllianceID"/> 
						<!--SID:-->
						<ns:UniqueID Type="503" ID="$SID"/> 
					</ns:HotelReservation> 
				</ns:HotelReservations> 
			</ns:OTA_HotelResNotifRQ>
		</RequestBody>
	</HotelRequest>
</Request>



BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function HotelResNotifmain(){
		try{
			$requestXML=$this->HotelResNotif();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_HotelResNotif;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
	/******************************* 3.7.2.10. 订单变化查询 OTA_HotelResNotif 结束 *******************/
	
		/******************************* 3.7.2.10. 订单详情查询   开始 *******************/
		function HotelOrderDetail(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="D_HotelOrderDetail";
		
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   

  <DomesticHotelOrderDetailRequest>
    <UserID>$this->userid</UserID>
   <UserIP>223.4.152.106</UserIP>
    <OrderID>$this->orderid</OrderID> 
  </DomesticHotelOrderDetailRequest>
</Request>



BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function HotelOrderDetailmain(){
		try{
			$requestXML=$this->HotelOrderDetail();
			
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=D_HotelOrderDetail;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
	/******************************* 3.7.2.10. 订单详情查询  结束 *******************/
			/******************************* 3.7.2.10. 取消订单   开始 *******************/
		function HotelOrderCancel(){
 
 		/*
		 * 从config.php中获取系统的联盟信息(只读)
		 */
		$AllianceID=Allianceid;
		$SID=Sid;
		$KEYS=SiteKey;
		$RequestType="OTA_Cancel";
		
		//构造权限头部
		$headerRight=getRightString($AllianceID,$SID,$KEYS,$RequestType);
		$paravalues=<<<BEGIN
<?xml version="1.0" encoding="utf-8"?>
<Request>
<Header $headerRight/>   

	<HotelRequest>
		<RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
			<ns:OTA_CancelRQ TimeStamp="2012-04-20T00:00:00.000+08:00" Version="1.0">
				<ns:UniqueID ID="$AllianceID" Type="28" />
				<ns:UniqueID ID="$this->orderid" Type="501"/>
				<ns:UniqueID ID="$SID" Type="503"/>
				<!--UserUniqueID:-->
				<ns:UniqueID ID="$this->userid" Type="1"/>
			</ns:OTA_CancelRQ>
		</RequestBody>
	</HotelRequest>
</Request>




BEGIN;
		return  $paravalues;
 
 
 
 }
   /**
	 *
	 * 调用接口
	 */
	function HotelOrderCancelmain(){
		try{
			$requestXML=$this->HotelOrderCancel();
			$commonRequestDo=new commonRequest();//常用数据请求
		 	$commonRequestDo->requestURL=OTA_Cancel;
		 	$commonRequestDo->requestXML=$requestXML;
		 	$commonRequestDo->requestType=System_RequestType;//取config中的配置
		 	$commonRequestDo->doRequest();
	 		$this->ResponseXML=getXMLFromReturnString($commonRequestDo->responseXML); 
		}
		catch(Exception $e)
		{
			$this->ResponseXML=null;
		}
	}
	
	/******************************* 3.7.2.10. 取消订单  结束 *******************/
	
}
 